package model;

import java.io.Serializable;

/**
 * Klasse Friendship
 * 
 * @author Magnus Brieler
 */
public class Friendship implements Serializable {
	
	//Attribute
	private User friend;
	private boolean good;
	private String note;
	
	//Konstruktoren
	public Friendship() {
		friend = new User();
		good = false;
		note = "";
	}
	
	public Friendship(User friend) {
		this.friend = friend;
		good = false;
		note = "";
	}
	
	public Friendship(User friend, boolean good) {
		this.friend = friend;
		this.good = good;
	}
	
	public Friendship(User friend, boolean good, String note) {
		this.friend = friend;
		this.good = good;
		this.note = note;
	}
	
	//Getter
	public User getFriend() {
		return friend;
	}

	public boolean getGood() {
		return good;
	}
	
	public String getNote() {
		return note;
	}
	
	//Setter
	public void setFriend(User friend) {
		this.friend = friend;
	}
	
	public void setGood(boolean good) {
		this.good = good;
	}
	
	public void setNote(String note) {
		this.note = note;
	}
	
	//Methoden
	public String toString() {
		if(good) {
			return friend.getFirstName() + " " + friend.getLastName() + " (" + friend.getUserName() + ")";
		} else {
			return friend.getUserName();
		}
	}
	
	public boolean equals(Object o) {
		return friend.getId() == ((Friendship)o).getFriend().getId();
	}
	
}